<?php

namespace App\Formats;

/**
 * Class Formats
 * @return Formats
 * @package App\Formats
 * #Formats List:
 * @property ArticleFormat $ArticleFormat
 * @property CollectFormat $CollectFormat
 * @property DynamicFormat $DynamicFormat
 * @property LikeFormat $LikeFormat
 * @property NoteFormat $NoteFormat
 * @property RecommendSystemFormat $RecommendSystemFormat
 * @property TopicFormat $TopicFormat
 * #Formats end.
 */
class Formats
{
    public static function __callStatic($method, $parameters)
    {
        return (new static)->$method(...$parameters);
    }

    public function __toString()
    {
        return json_encode($this);
    }

    public function __get($property)
    {
        if (isset($this->$property)) {
            return $this->$property;
        } else {
            $instance = 'App\\Formats\\' . $property;
            $buildFactory = new $instance();
            return $this->$property = $buildFactory;
        }
    }

    public function __set($property, $value)
    {
        $this->$property = $value;
    }

    public function __clone()
    {
        return null;
    }
}
